package cj.primariaiquest.integration.endpoints;

import static cj.primariaiquest.commons.Constants.CANCEL_HEADER;

import org.springframework.integration.Message;
import org.springframework.integration.core.MessageSelector;

/**
 * Filter used to filter canceled tickets .
 * 
 * @author georgian.parvu
 * 
 */
public class TicketFilter implements MessageSelector {

    /**
     * Filters messages based on their canceled header. If canceled is false
     * then the message will be accepted, else no.
     */
    @Override
    public boolean accept(Message<?> message) {
	return !(Boolean) message.getHeaders().get(CANCEL_HEADER);
    }

}
